package bricks.entity;

import javafx.scene.canvas.GraphicsContext;
import javafx.scene.image.Image;
import javafx.scene.shape.Rectangle;

public abstract class AbstractGraph {

    protected double x;

    protected double y;

    private double width;

    private double height;

    protected Image image;

    protected boolean life;

    public AbstractGraph(double x, double y, double width, double height) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
        this.life = true;
    }

    public double getX() {
        return x;
    }

    public void setX(double x) {
        this.x = x;
    }

    public double getY() {
        return y;
    }

    public void setY(double y) {
        this.y = y;
    }

    public Image getImage() {
        return image;
    }

    public void setImage(Image image) {
        this.image = image;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public void draw(GraphicsContext graphic) {
        if (life) {
            graphic.drawImage(image, x, y, width, height);
        }
    }

    public boolean isLife() {
        return life;
    }

    public Rectangle getBoundBox(){
        return new Rectangle(x, y, width, height);
    }
}
